<template>
  <el-card class="left-menu" shadow="hover">
    <el-scrollbar>
      <el-menu :default-openeds="['1', '2', '3']" :default-active="activeMenu" class="el-menu-vertical" @select="handleMenuClick">
        <!-- 患者详情部分 -->
        <div class="menu-section">
          <div class="section-title">患者详情</div>
          <el-menu-item index="RightContent">
            <el-icon><Document /></el-icon>
            <span>患者详情</span>
          </el-menu-item>
        </div>

        <!-- 智能辅助部分 -->
        <div class="menu-section">
          <div class="section-title">智能辅助</div>
          <el-menu-item-group>
            <el-menu-item index="risk-assessment">
              <el-icon><Warning /></el-icon>
              <span>风险评估</span>
            </el-menu-item>
            <el-menu-item index="ai-diagnosis">
              <el-icon><Cpu /></el-icon>
              <span>AI辅助诊断</span>
            </el-menu-item>
          </el-menu-item-group>
        </div>

        <!-- 处方管理部分 -->
        <div class="menu-section">
          <div class="section-title">处方管理</div>
          <el-menu-item index="prescription-suggestions">
            <el-icon><Document /></el-icon>
            <span>处方建议</span>
          </el-menu-item>
        </div>


      </el-menu>
    </el-scrollbar>
  </el-card>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { Warning, Cpu, Document } from '@element-plus/icons-vue'
import { useRouter, useRoute } from 'vue-router'

const router = useRouter()
const route = useRoute()

// 切换左侧菜单
const activeMenu = ref('RightContent')
const handleMenuClick = (menu: string) => {
  activeMenu.value = menu
  const patientId = route.params.id
  router.push(`/doctor/patient-detail/${patientId}/${menu}`)
}
</script>

<style scoped lang="scss">
.left-menu {
  width: 220px;
  border-radius: 8px;
  overflow: hidden;

  .menu-header {
    font-size: 16px;
    font-weight: 500;
  }

  .el-menu-vertical {
    border-right: none;
  }

  .el-menu-item {
    .el-icon {
      margin-right: 8px;
    }
  }
}
</style>